﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.Settlement.Dto
@model IPagedList<SettlementAccountOutputDto>
@{
    Layout = null;
}
<div>

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th>编号</th>
                <th>名称</th>
                <th>初始日期</th>
                <th>初始金额</th>
                <th style="width:200px;">操作</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td colspan="5">暂无账户信息</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    <tr>
                        <td>@item.Number</td>
                        <td>@item.Name</td>
                        <td>@(item.InitialDate.HasValue ? item.InitialDate.Value.ToString("yyyy-MM-dd hh:mm:ss") : "")</td>
                        <td>@item.InitialAmount</td>
                        <td>
                            @if (IsGranted(FwProject.Authorization.PermissionNames.Finance_Operation_ModifyAccount))
                            {
                                <button class="btn btn-success btn-xs" data-toggle="modal" data-target="#modal_ajax" data-backdrop="static" data-url="@Url.Action("EditAccount", new { id = item.Id })"><i class="fa fa-edit"></i>编辑</button>
                            }
                            @if (IsGranted(FwProject.Authorization.PermissionNames.Finance_Operation_DeleteAccount))
                            {
                                <button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#modal_del" data-url="@Url.Action("DeleteAccount", new { id = item.Id })"><i class="fa fa-times"></i>删除</button>
                            }

                        </td>
                    </tr>
                }
            }
        </tbody>
    </table>
</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        @Html.PagedListPager(Model, page => Url.Action("SettlementAccount", new { pageIdx = page, keyword = Context.Request.Query["keyword"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>
